import { IPSDEFFormItem } from './ipsdefform-item';
import { IPSDataEntity } from '../../dataentity/ipsdata-entity';
import { IPSDEACMode } from '../../dataentity/ac/ipsdeacmode';
import { IPSDEDataSet } from '../../dataentity/ds/ipsdedata-set';
import { IPSLanguageRes } from '../../res/ipslanguage-res';
import { IPSSysImage } from '../../res/ipssys-image';
import { PSModelObjectImpl } from '../../psmodel-object-impl';

export class PSDEFFormItemImpl extends PSModelObjectImpl implements IPSDEFFormItem {
  protected cappslanguageres: IPSLanguageRes | null = null;

  getCapPSLanguageRes(): IPSLanguageRes | null {
    if (this.cappslanguageres != null) return this.cappslanguageres;
    const value = this.M.getCapPSLanguageRes;
    if (value == null) {
      return null;
    }
    this.cappslanguageres = this.getPSModel4('res.IPSLanguageRes', value, 'getCapPSLanguageRes') as IPSLanguageRes;
    return this.cappslanguageres;
  }

  get capPSLanguageRes(): IPSLanguageRes | null {
    return this.getCapPSLanguageRes();
  }

  getCapPSLanguageResMust(): IPSLanguageRes {
    const value = this.getCapPSLanguageRes();
    if (value == null) {
      throw new Error('未指定标题语言资源');
    }
    return value;
  }

  get codeName(): string {
    return this.M.codeName;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  get editorHeight(): number {
    return this.M.editorHeight;
  }

  get editorParams(): IModel {
    return this.M.editorParams;
  }

  get editorStyle(): string {
    return this.M.editorStyle;
  }

  get editorType(): string {
    return this.M.editorType;
  }

  get editorWidth(): number {
    return this.M.editorWidth;
  }

  get maxValueString(): string {
    return this.M.maxValueString;
  }

  get memo(): string {
    return this.M.memo;
  }

  get minStringLength(): number {
    return this.M.minStringLength != null ? this.M.minStringLength : 0;
  }

  get minValueString(): string {
    return this.M.minValueString;
  }

  get name(): string {
    return this.M.name;
  }

  get originCaption(): string {
    return this.M.originCaption;
  }

  get outputCodeListConfigMode(): 0 | 1 | 2 {
    return this.M.outputCodeListConfigMode != null ? this.M.outputCodeListConfigMode : 0;
  }

  protected phpslanguageres: IPSLanguageRes | null = null;

  getPHPSLanguageRes(): IPSLanguageRes | null {
    if (this.phpslanguageres != null) return this.phpslanguageres;
    const value = this.M.getPHPSLanguageRes;
    if (value == null) {
      return null;
    }
    this.phpslanguageres = this.getPSModel4('res.IPSLanguageRes', value, 'getPHPSLanguageRes') as IPSLanguageRes;
    return this.phpslanguageres;
  }

  get pHPSLanguageRes(): IPSLanguageRes | null {
    return this.getPHPSLanguageRes();
  }

  getPHPSLanguageResMust(): IPSLanguageRes {
    const value = this.getPHPSLanguageRes();
    if (value == null) {
      throw new Error('未指定输入提示语言资源');
    }
    return value;
  }

  protected pssysimage: IPSSysImage | null = null;

  getPSSysImage(): IPSSysImage | null {
    if (this.pssysimage != null) return this.pssysimage;
    const value = this.M.getPSSysImage;
    if (value == null) {
      return null;
    }
    this.pssysimage = this.getPSModel4('res.IPSSysImage', value, 'getPSSysImage') as IPSSysImage;
    return this.pssysimage;
  }

  get psSysImage(): IPSSysImage | null {
    return this.getPSSysImage();
  }

  getPSSysImageMust(): IPSSysImage {
    const value = this.getPSSysImage();
    if (value == null) {
      throw new Error('未指定图标图片资源对象');
    }
    return value;
  }

  get placeHolder(): string {
    return this.M.placeHolder;
  }

  get precision(): number {
    return this.M.precision != null ? this.M.precision : 0;
  }

  get refLinkPSDEViewCodeName(): string {
    return this.M.refLinkPSDEViewCodeName;
  }

  get refMPickupPSDEViewCodeName(): string {
    return this.M.refMPickupPSDEViewCodeName;
  }

  protected refpsdeacmode: IPSDEACMode | null = null;

  getRefPSDEACMode(): IPSDEACMode | null {
    if (this.refpsdeacmode != null) return this.refpsdeacmode;
    const value = this.M.getRefPSDEACMode;
    if (value == null) {
      return null;
    }
    this.refpsdeacmode = this.getRefPSDataEntityMust().findPSDEACMode(value);
    return this.refpsdeacmode;
  }

  get refPSDEACMode(): IPSDEACMode | null {
    return this.getRefPSDEACMode();
  }

  getRefPSDEACModeMust(): IPSDEACMode {
    const value = this.getRefPSDEACMode();
    if (value == null) {
      throw new Error('未指定引用实体自填模式');
    }
    return value;
  }

  protected refpsdedataset: IPSDEDataSet | null = null;

  getRefPSDEDataSet(): IPSDEDataSet | null {
    if (this.refpsdedataset != null) return this.refpsdedataset;
    const value = this.M.getRefPSDEDataSet;
    if (value == null) {
      return null;
    }
    this.refpsdedataset = this.getRefPSDataEntityMust().findPSDEDataSet(value);
    return this.refpsdedataset;
  }

  get refPSDEDataSet(): IPSDEDataSet | null {
    return this.getRefPSDEDataSet();
  }

  getRefPSDEDataSetMust(): IPSDEDataSet {
    const value = this.getRefPSDEDataSet();
    if (value == null) {
      throw new Error('未指定引用实体数据集');
    }
    return value;
  }

  protected refpsdataentity: IPSDataEntity | null = null;

  getRefPSDataEntity(): IPSDataEntity | null {
    if (this.refpsdataentity != null) return this.refpsdataentity;
    const value = this.M.getRefPSDataEntity;
    if (value == null) {
      return null;
    }
    this.refpsdataentity = this.getPSModel4('dataentity.IPSDataEntity', value, 'getRefPSDataEntity') as IPSDataEntity;
    return this.refpsdataentity;
  }

  get refPSDataEntity(): IPSDataEntity | null {
    return this.getRefPSDataEntity();
  }

  getRefPSDataEntityMust(): IPSDataEntity {
    const value = this.getRefPSDataEntity();
    if (value == null) {
      throw new Error('未指定引用实体对象');
    }
    return value;
  }

  get refPickupPSDEViewCodeName(): string {
    return this.M.refPickupPSDEViewCodeName;
  }

  get stringLength(): number {
    return this.M.stringLength != null ? this.M.stringLength : 0;
  }

  get uIMode(): 'DEFAULT' | 'CUSTOM' | 'MOBILEDEFAULT' | 'APPDEFAULT' | 'MODE1' | 'MODE2' | 'MODE3' | 'MODE4' | 'MODE5' | 'MODE6' | 'MODE7' | 'MODE8' | 'MODE9' {
    return this.M.uIMode;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get valueFormat(): string {
    return this.M.valueFormat || '%1$s';
  }

  get allowEmpty(): boolean {
    return this.M.allowEmpty != null ? this.M.allowEmpty : true;
  }

  get mobileMode(): boolean {
    return this.M.mobileMode != null ? this.M.mobileMode : false;
  }

  get needCodeListConfig(): boolean {
    return this.M.needCodeListConfig != null ? this.M.needCodeListConfig : false;
  }

  get cls(): string {
    return 'PSDEFFormItemImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'control.form.IPSDEFFormItem') return true;
    return super.instanceof(cls);
  }
}
